import * as BaseApi from './BaseApi.js';

import * as Config from './Config.js';

export const queryCarModel = (seriesId, years) => {

	let data = {
		seriesId: seriesId,
		years: years
	}

	return BaseApi.requestForm(Config.g_service_url, '/modellist', data)
		.then(res => res)

}
// 调用查询品牌接口
export const queryBrandList = () => {

	let data = {}

	return BaseApi.requestForm(Config.g_service_url, '/brandlist', data)
		.then(res => res)
}
// 调用查询车系接口
export const querySeriesList = (brandId) => {

	let data = {
		brandId: brandId
	}

	return BaseApi.requestForm(Config.g_service_url, '/serieslist', data)
		.then(res => res)

}

export const addGoodsCarLink = (goodsId, linkIds) => {

	let params = {}
	params.token = sessionStorage.getItem("token")
	params.merchantId = sessionStorage.getItem("merchantId")
	params.goodsId = goodsId
	params.linkIds = linkIds
	params.linkType = 'CAR'

	return BaseApi.requestForm(Config.g_biz_url, '/goods/car/linkadd', params)
		.then(res => res)

}

export const deleteGoodsCarLink = (linkId) => {

	let params = {}
	params.token = sessionStorage.getItem("token")
	params.merchantId = sessionStorage.getItem("merchantId")
	params.goodsCarLinkId = linkId

	return BaseApi.requestForm(Config.g_biz_url, '/goods/car/linkdelete', params)
		.then(res => res)

}

//POST /goods/car/linkadd